/*
 * @Author: CQJ
 * @Date: 2022-08-25 20:00:27
 * @LastEditors: CQJ
 * @LastEditTime: 2022-09-08 16:56:27
 * @Description:
 */
import { reactive } from 'vue'
type Key = string
interface AlbumState {
  // 所属分类
  album_id: string | undefined
  album_status: number | undefined
  // 子分类关键词
  album_keyword: string | undefined
  site_id: string | undefined
}

// 状态管理
export const albumState = reactive<AlbumState>({
  album_status: undefined,
  album_id: undefined,
  album_keyword: undefined,
  site_id: undefined
})
interface IStatusState {
  isEdit: boolean
  addClassify: boolean
  addSubClassify: boolean
  selectedRowKeys: Key[]
  isAdd: boolean
}
export const statusState = reactive<IStatusState>({
  isEdit: false,
  addClassify: false,
  addSubClassify: false,
  selectedRowKeys: [],
  isAdd: false
})

export interface ILeftData {
  categ_id: string | undefined
  subcateg_id: string | undefined
  article_id: string | undefined
  article_keyword: string | undefined
  site_id: string | undefined
  status: number | undefined
}
export const leftState = reactive<ILeftData>({
  categ_id: undefined,
  subcateg_id: undefined,
  article_id: undefined,
  article_keyword: undefined,
  site_id: undefined,
  status: 1
})
export const resetDialogState = () => {
  let key: keyof ILeftData
  for (key in leftState) {
    leftState[key] = undefined
  }
}
export const resetState = () => {
  let key: keyof AlbumState
  for (key in albumState) {
    albumState[key] = undefined
  }
}
